﻿@model eShop.Web.Admin.Models.ProductReviewListModel

@section header{
    <title>商品评价列表</title>
    <link type="text/css" rel="stylesheet" href="/administration/css/site.css" />
    <link type="text/css" rel="stylesheet" href="/administration/css/style.css" />
    <script type="text/javascript" src="/administration/scripts/jquery.js"></script>
    <script type="text/javascript" src="/administration/scripts/showlist.js"></script>
    <link href="/components/jbox/Skins/Default/jbox.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/components/jbox/jquery.jBox-2.3.min.js"></script>
    <script type="text/javascript" src="/administration/scripts/selectlist.js"></script>
    <script type="text/javascript" src="/components/my97datepicker/WdatePicker.js"></script>
    <script type="text/javascript">
        /*状态*/
        $(function () {
            //
            $('.tablelist tbody tr:odd').addClass('odd');
            //
            $(".changeState").click(function () {
                var obj = $(this);
                var state = obj.attr("state");
                var message = "";
                var url = "";
                if (state == "1") {
                    message = "您确认要屏蔽此评价吗？";
                    url = obj.attr("url") + "&state=1" + "&t=" + new Date();
                }
                else {
                    message = "您确认要显示此评价吗？";
                    url = obj.attr("url") + "&state=0" + "&t=" + new Date();
                }
                $.jBox.confirm(message, "提示", function (v, h, f) {
                    if (v == 'ok') {
                        $.jBox.tip("正在设置...", 'loading');
                        $.get(url, function (data, textStatus) {
                            if (data != "0") {
                                if (state == "1") {
                                    obj.attr("state", 0);
                                    obj.html("[显示]");
                                    obj.parents("tr").find(".stateTd").html("屏蔽");
                                }
                                else {
                                    obj.attr("state", 1);
                                    obj.html("[屏蔽]");
                                    obj.parents("tr").find(".stateTd").html("显示");
                                }
                                $.jBox.tip('设置成功！', 'success');
                            } else {
                                $.jBox.error('设置失败，请联系管理员！', '设置失败');
                            }
                        });
                    }
                    else if (v == 'cancel') {
                        // 取消
                    }
                    return true; //close
                });
                return false;
            });
        })
    </script>
}

@section body{
    <h1 class="rightH1">
        商品评价 &gt;&gt; 商品评价列表
        <div class="right">
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>
    @using (Html.BeginForm("productreviewlist", "productreview"))
    {
        <div class="dataListSearch">
            <table height="32">
                <tbody>
                    <tr>
                        <td width="35"><img id="searchImg" src="/administration/images/search1.gif" /></td>
                        <td>商品名称：</td>
                        <td>
                            <div class="selectBt">
                                <input type="button" value="@Model.ProductName" onclick="openProductSelectLayer(this)" style="height:22px; line-height:2px;background:url(/administration/images/selectbgico.gif) no-repeat 6px center; padding-left:22px; padding-right:10px;" />
                                <input type="hidden" class="Pid" id="Pid" name="Pid" value="@Model.Pid" />
                                <input type="hidden" class="ProductName" id="ProductName" name="ProductName" value="@Model.ProductName" />
                            </div>
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;评价内容：</td>
                        <td>@Html.TextBox("Message", Model.Message, new { height = "28", size = "15" })</td>
                        <td>&nbsp;&nbsp;&nbsp;开始时间：</td>
                        <td width="130">@Html.TextBox("StartTime", Model.StartTime, new { height = "18", onclick = "WdatePicker({el:'StartTime'})" })</td>
                        <td>&nbsp;&nbsp;&nbsp;结束时间：</td>
                        <td width="130">@Html.TextBox("EndTime", Model.EndTime, new { height = "18", onclick = "WdatePicker({el:'EndTime'})" })</td>
                        <td><input id="SearchProductReview" name="SearchProductReview" type="image" class="searchBut submit" src="/administration/images/s.jpg" /></td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div style="padding-left:15px;">
            <table class="tablelist">
                <thead>
                    <tr>
                        <th width="80" align="left">用户名</th>
                        <th width="260" align="left">商品</th>
                        <th width="200" align="left">内容</th>
                        <th width="50" align="left">评分</th>
                        <th width="50" align="left">状态</th>
                        <th width="140" align="left">评价时间</th>
                        <th width="146" align="left">管理操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (DataRow row in Model.ProductReviewList.Rows)
                    {
                        <tr>
                            <td>@row["nickname"]</td>
                            <td>@row["pname"]</td>
                            <td>@row["message"]</td>
                            <td>@row["star"]星</td>
                            <td class="stateTd">
                                @if (row["state"].ToString() == "0")
                                {
                                    @:显示
      }
                                else
                                {
                                    @:屏蔽
      }
                            </td>
                            <td>@row["reviewtime"]</td>
                            <td>
                                <a href="@Url.Action("productreviewreplylist", new { reviewId = row["reviewid"] })" class="editOperate">[回复列表]</a>

                                @if (row["state"].ToString() == "0")
                                {
                                    <a href="#" url="@Url.Action("changeproductreviewstate", new { reviewId = row["reviewid"] })" state="1" class="editOperate changeState">[屏蔽]</a>
                                }
                                else
                                {
                                    <a href="#" url="@Url.Action("changeproductreviewstate", new { reviewId = row["reviewid"] })" state="0" class="editOperate changeState">[显示]</a>
                                }
                                @Html.ActionLink("[删除]", "delproductreview", new { reviewId = row["reviewid"] }, new { @class = "deleteOperate" })
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
        <div class="dataListEdit">
            <div class="page">
                @Html.AdminPager(Model.PageModel)
            </div>
        </div>
    }
}